package com.rest.demo.functional.api;

import java.util.regex.Pattern;
import java.util.stream.Collectors;

/**
 * @author Administrator
 * @decription
 * @Date 2018-01-31 11:14
 */
public class StringApi {
    public static void main(String[] args) {
        String str = String.join(":","yang","bo","qi","bing","yang","jia");
        String result = str.chars()
                .distinct()
                .mapToObj(c -> String.valueOf((char)c)).sorted()
                .collect(Collectors.joining(""));
        System.out.println("result:"+result);

        String result2 = Pattern.compile(":")
                .splitAsStream(str)
                .filter(s -> s.contains("y"))
                .sorted()
                .collect(Collectors.joining(":"));
        System.out.println(result2);


    }
}
